﻿/*
Copyright 2009 Matías Fidemraizer (www.matiasfidemraizer.com).

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
*/

using System;

#region "Custom namespace declarations"
using Comkarl.Architecture.Patterns.MVC.Entities;
#endregion

namespace Comkarl.Architecture.Patterns.MVC.Entities
{
    /// <summary>
    /// Represents the event arguments for a controller action performed by some view.
    /// </summary>
    /// <typeparam name="TIdentifierName">
    /// The type for the identifier's name.
    /// </typeparam>
    public sealed class ControllerActionEventArgs<TIdentifierName> : EventArgs 
        where TIdentifierName : IEquatable<TIdentifierName>
    {
        #region "Fields"
        /// <summary>
        /// Retrieves the action which is going to be served to some observer.
        /// </summary>
        private readonly Comkarl.Architecture.Patterns.MVC.Entities.Action<TIdentifierName> currentAction;
        #endregion

        #region "Constructors"

        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="currentAction">
        /// An action performed by some controller.
        /// </param>
        public ControllerActionEventArgs(Entities.Action<TIdentifierName> currentAction)
        {
            this.currentAction = currentAction;
        }
        #endregion

        /// <summary>
        /// Gets the action performed by some controller.
        /// </summary>
        public Entities.Action<TIdentifierName> CurrentAction
        {
            get
            {
                return currentAction;
            }
        }
    }
}
